/**
 * 基础架构层统一导出
 */
export { BaseService } from './BaseService';
export { BaseController } from './BaseController';
export { BaseComponent } from './BaseComponent';

/**
 * 基础接口定义
 */
export interface IService {
    init(): Promise<void>;
    destroy(): Promise<void>;
    getServiceName(): string;
    isReady(): boolean;
}

export interface IController {
    init(): Promise<void>;
    destroy(): Promise<void>;
    getControllerName(): string;
    isReady(): boolean;
}

export interface IComponent {
    init(): void;
    destroy(): void;
    getComponentName(): string;
    isReady(): boolean;
}

/**
 * 生命周期状态枚举
 */
export enum LifecycleState {
    CREATED = 'created',
    INITIALIZING = 'initializing',
    INITIALIZED = 'initialized',
    DESTROYING = 'destroying',
    DESTROYED = 'destroyed',
    ERROR = 'error'
}

/**
 * 操作结果接口
 */
export interface OperationResult<T = any> {
    success: boolean;
    data?: T;
    message?: string;
    error?: string;
    timestamp: Date;
}

/**
 * 创建操作结果的工具函数
 */
export function createSuccessResult<T>(data?: T, message?: string): OperationResult<T> {
    return {
        success: true,
        data,
        message,
        timestamp: new Date()
    };
}

export function createErrorResult(error: string, message?: string): OperationResult {
    return {
        success: false,
        error,
        message,
        timestamp: new Date()
    };
}
